/*
 * @Author: llixxm
 * @Date: 2020-01-08 15:20:52
 * @Description: 获取默认账簿 -- 云原生小部件
 */
import {ajax} from 'nc-lightapp-front';
/**
 * @description: 云原生小部件 获取默认账簿
 * @param {type} 
 * @return: 
 */
export default function getDefaultAccountBookForWidget(appcode,json){   
    let pk_accountingbook={};
    let url='/nccloud/platform/appregister/queryappcontext.do';
    return  new Promise((resolve, reject) => {
        ajax({
            url:url,
            data:{
                appcode: appcode,
            },
            sysAppcode: appcode, //用于服务转发
            success: (response) => {
                let { data, success } = response;
                if (success) {
                    pk_accountingbook.display = data.defaultAccbookName ? data.defaultAccbookName : '';
                    pk_accountingbook.value = data.defaultAccbookPk ? data.defaultAccbookPk : '';
                    pk_accountingbook.moduleid = data.paramMap ? data.paramMap.moduleid : '';
                }
                resolve(pk_accountingbook)
            },
        })
    })
}
